package app.util.image.action
{
	import app.util.*;
	
	import flash.display.*;
	import flash.geom.*;
	
	public class ResizeAction extends AbstractAction
	{
		private var w:int;
		private var h:int;
		
		public function ResizeAction(w:int, h:int)
		{
			this.w = w;
			this.h = h;	
		}
		
		public override function getDescription():String
		{
			return "Resize (" + this.w + ", " + this.h + ")";
		}
		
		public override function getActionedBitmapData():BitmapData
		{
			var old:BitmapData = Mediator.getCurrentBitmapData();
			var resize:BitmapData = new BitmapData(this.w, this.h);
			var resizeMatrix:Matrix = new Matrix();
			resizeMatrix.scale(this.w / old.width, this.h / old.height);
			resize.draw(old, resizeMatrix);
			return resize;
		}
	}
}